package unit3;

public class Ex3_9_TestPassingObject {
    public static void main(String[] args) {
        Circle1 myCircle = new Circle1();
        int n = 5;
        printAreas(myCircle, n); //对象myCircle作为实参
        System.out.println("\n" + "半径是： " + myCircle.radius);
        System.out.println("n 的值为： " + n);
    }
    public static void printAreas(Circle1 c, int times) {
        // c为对象类型的形参
        System.out.println("半径 \t\t面积");
        while (times >= 1) {
            System.out.println(c.radius + "\t\t" + c.findArea());
            c.radius++;
            times--;
        }
    }
}
class Circle1 {
    double radius = 1.0;
    double findArea() {
        return radius * radius * 3.14159;
    }
}
